<!-- 绿色通道 - 患者列表 - 医疗记录 - 血液检查 界面 -->
<template>
  <div id="box">
    <div class="bloodContent">
      <div class="addContent">
        <el-button type="primary"
          style="float: right;margin-right: 40px;margin-top: 8px;font-size: 16px;padding: 8px 15px;" @click="popup">
          新 增
        </el-button>
      </div>
      <center v-if="noData">
        <h3>无数据</h3>
      </center>
      <div v-show="myocardialenzymesList.length" class="content">
        <div>
          <span style="font-size: 18px;">生物标志物</span>
          <div v-for="(myocardialenzymesItem, index) in newParestMyocardiaData" :key="index" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span class="red-star">抽血时间：</span>
                  <el-date-picker v-model="myocardialenzymesItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px" class="red-star">报告时间：</span>
                  <el-date-picker v-model="myocardialenzymesItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span>{{ myocardialenzymesItem.createTime }}</span>
                  <!-- <span style="margin-left:20px">曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ myocardialenzymesItem.department }}</span>
                  <span>{{ myocardialenzymesItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(orderDetailItem, indexOrder) in myocardialenzymesItem.json.orderDetail" :key="indexOrder">
                  <el-col :span="8">
                    <span>{{ orderDetailItem.abbr }} ：</span>
                    <el-input v-model="orderDetailItem.value" value="orderDetailItem.value" placeholder="" size="mini"
                      style="margin-left:10px;width:20%" @change="linkagejudgement" />
                    <el-select v-if="orderDetailItem.abbr === '肌钙蛋白T'" v-model="orderDetailItem.unit" size="mini"
                      style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in TroponinTUnit" :key="item.value" :label="item.label"
                        :value="item.value" />
                    </el-select>
                    <el-select v-if="orderDetailItem.abbr === '肌钙蛋白I'" v-model="orderDetailItem.unit" size="mini"
                      style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in TroponinIUnit" :key="item.value" :label="item.label"
                        :value="item.value" />
                    </el-select>
                    <el-select v-if="orderDetailItem.abbr === 'D-二聚体'" v-model="orderDetailItem.unit" size="mini"
                      style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in polymersUnit" :key="item.valueTwo" :label="item.label"
                        :value="item.valueTwo" />
                    </el-select>
                    <el-select v-if="orderDetailItem.abbr === '肌红蛋白'" v-model="orderDetailItem.unit" size="mini"
                      style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in myoglobinUnit" :key="item.valueTwo" :label="item.label"
                        :value="item.valueTwo" />
                    </el-select>
                    <el-select v-if="orderDetailItem.abbr === '肌酸激酶同工酶'" v-model="orderDetailItem.unit" size="mini"
                      style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in CKMBUnit" :key="item.valueTwo" :label="item.label"
                        :value="item.valueTwo" />
                    </el-select>
                    <!-- <el-select v-if="orderDetailItem.abbr === '脑钠肽' || orderDetailItem.abbr === 'NT-proBNP'"
                      v-model="orderDetailItem.unit" disabled size="mini" style="margin-left:10px;width:25%"
                      placeholder="">
                      <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
                    </el-select> -->
                    <span v-if="orderDetailItem.abbr === '脑钠肽' || orderDetailItem.abbr === 'N-端脑利钠肽前体'"
                      style="margin-left:10px">{{ orderDetailItem.unit }}</span>
                    <el-select v-if="orderDetailItem.type === 'TroponinI'" v-model="orderDetailItem.judgement" disabled
                      size="mini" style="margin-left:10px;width:25%" placeholder="">
                      <el-option v-for="item in option" :key="item.valueone" :label="item.label"
                        :value="item.valueone" />
                    </el-select>
                  </el-col>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="myocardialenzymesItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%;margin-top:-10px" size="mini"
              @click="saveMyocardialenzymes(myocardialenzymesItem.itemType, index, myocardialenzymesItem.remarks)">保存</el-button>
          </div>
          <div v-if="myocardialenzymesList.length !== 0 && myocardialenzymesList.length !== 1" class="trendContent">
            <el-button type="text" @click="goViewMyocardialenzymes()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:450px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="FourItemsBloodCoagulationList.length" class="content">
        <div>
          <span style="font-size: 18px;">凝血功能</span>
          <div v-for="(fouBloodCItem, fourItemIndex) in FourItemsBloodCoagulationList" :key="fouBloodCItem.id"
            class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span class="red-star">抽血时间：</span>
                  <el-date-picker v-model="fouBloodCItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px" class="red-star">报告时间：</span>
                  <el-date-picker v-model="fouBloodCItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ fouBloodCItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ fouBloodCItem.department }}</span>
                  <span>{{ fouBloodCItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(fourOrderItem, fourIndex) in fouBloodCItem.json.orderDetail" :key="fourIndex"
                  style="float:left">
                  <span>{{ fourOrderItem.abbr }}</span>
                  <el-input v-model="fourOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ fourOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="fouBloodCItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(fouBloodCItem.itemType, fourItemIndex, fouBloodCItem.remarks)">保存</el-button>
          </div>
          <div v-if="FourItemsBloodCoagulationList.length !== 0 && FourItemsBloodCoagulationList.length !== 1"
            class="trendContent">
            <el-button type="text" @click="goViewFourItemsBloodCoagulation()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:450px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <!--  设备获取凝血功能  -->
      <div v-show="FourItemsBloodCoagulationListInput.length" class="content">
        <div v-for="(fouBloodCItemInput, inputIndex) in FourItemsBloodCoagulationListInput" :key="inputIndex"
          class="publicStyle">
          <el-row>
            <el-col :span="10">
              <div class="grid-content bg-purple">
                <span>三诺lCare2000</span>
                <span style="padding-left: 20px;">检测时间 ：{{ msgdataTestTime }}</span>
              </div>
            </el-col>
            <el-col :span="14">
              <div class="grid-content bg-purple-light">
                <span style="margin:0 25px 0 30%">{{ fouBloodCItemInput.excuteTime }}</span>
                <span style="margin:0 25px">{{ fouBloodCItemInput.itemName }}</span>
              </div>
            </el-col>
          </el-row>
          <div style="width: 100%;height: 80px;" class="publicDown">
            <div v-for="(medicalResultItem, medicalResultIndex) in fouBloodCItemInput.msgdata.medicalResultIndexMap"
              :key="medicalResultIndex"
              style="float:left;margin: 10px 0;font-size: 15px;margin-right: 30px;padding: 5px 10px;">
              <span>{{ medicalResultItem.cnname }} ({{ medicalResultItem.medicalUnits }})</span>
              <!-- <el-input v-model="value" placeholder="" size="mini" style="margin-left:10px;width:30%" /> -->
              <span style="margin-left:20px;">{{ medicalResultItem.result }}</span>
              <span style="margin:20px">参考范围 : {{ medicalResultItem.medicalReference }}</span>
            </div>
          </div>
        </div>
      </div>
      <div v-show="bloodRoutineExaminationList.length" class="content">
        <div>
          <span style="font-size: 18px;">血常规</span>
          <div v-for="(routineItem, routIndex) in bloodRoutineExaminationList" :key="routIndex" class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span class="red-star">抽血时间：</span>
                  <el-date-picker v-model="routineItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px" class="red-star">报告时间：</span>
                  <el-date-picker v-model="routineItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ routineItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ routineItem.department }}</span>
                  <span>{{ routineItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(routineOrderItem, rOrderIndex) in routineItem.json.orderDetail" :key="rOrderIndex"
                  style="float:left;margin-top:5px">
                  <span>{{ routineOrderItem.abbr }}</span>
                  <el-input v-model="routineOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ routineOrderItem.unit }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="routineItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(routineItem.itemType, routIndex, routineItem.remarks)">保存</el-button>
          </div>
          <div v-if="bloodRoutineExaminationList.length !== 0 && bloodRoutineExaminationList.length !== 1"
            class="trendContent">
            <el-button type="text" @click="goViewbloodRoutineExamination()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:450px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
      <div v-show="serumCreatinineList.length" class="content">
        <div>
          <span style="font-size: 18px;">血生化</span>
          <div v-for="(serumCreatinineItem, serumCreatIndex) in serumCreatinineList" :key="serumCreatIndex"
            class="publicStyle">
            <el-row>
              <el-col :span="10">
                <div class="grid-content bg-purple">
                  <span class="red-star">抽血时间：</span>
                  <el-date-picker v-model="serumCreatinineItem.json.bloodTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                  <span style="margin-left:20px" class="red-star">报告时间：</span>
                  <el-date-picker v-model="serumCreatinineItem.json.resultTime" type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期时间" />
                </div>
              </el-col>
              <el-col :span="14">
                <div class="grid-content bg-purple-light">
                  <span style="margin:0 25px 0 30%">{{ serumCreatinineItem.createTime }}</span>
                  <!-- <span>曲阜市人民医院</span> -->
                  <span style="margin:0 25px">{{ serumCreatinineItem.department }}</span>
                  <span>{{ serumCreatinineItem.doctor }}</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <div v-for="(serumCreatOrderItem, serumOrderIndex) in serumCreatinineItem.json.orderDetail"
                  :key="serumOrderIndex" style="float:left">
                  <span class="red-star">{{ serumCreatOrderItem.abbr }} ：</span>
                  <el-input v-model="serumCreatOrderItem.value" placeholder="" size="mini"
                    style="margin-left:10px;width:30%" />
                  <span style="margin-left:10px">{{ serumCreatOrderItem.unit ? serumCreatOrderItem.unit : 'umol/L'
                    }}</span>
                </div>
              </div>
            </el-row>
            <el-row>
              <div class="grid-content bg-purple">
                <el-col :span="24">
                  <span>备注</span><span> ：</span>
                  <el-input v-model="serumCreatinineItem.remarks" placeholder=""
                    style="margin-left:10px;width:auto;min-width:50%" />
                </el-col>
              </div>
            </el-row>
            <el-button type="primary" style="margin-left:96%" size="mini"
              @click="saveMyocardialenzymes(serumCreatinineItem.itemType, serumCreatIndex, serumCreatinineItem.remarks)">保存</el-button>
          </div>
          <div v-if="serumCreatinineList.length !== 0 && serumCreatinineList.length !== 1" class="trendContent">
            <el-button type="text" @click="goViewSerumCreatinine()">
              <i class="el-icon-s-data" />
              <span style="margin:0 5px">趋势图</span>
            </el-button>
            <el-dialog :visible.sync="dialogVisible" width="50%">
              <div v-if="dialogVisible" class="Trend">
                <div ref="chart" style="width:900px;height:450px" />
              </div>
              <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
              </span>
            </el-dialog>
          </div>
        </div>
      </div>
    </div>
    <el-dialog title="新增血液检查" :visible.sync="newincalogase" width="60%" :before-close="handleClose">
      <el-tabs v-model="editableTabsValue" type="card" @tab-click="clickTab">
        <el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
          <!--关键代码，这个div里通过判断item.show的值来控制只把当前tab页渲染到dom树中-->
          <div v-if="item.show === true">
            <el-form ref="table_url" :model="item.request_tab_data" label-position="left" :rules="rules"
              label-width="240px" style="overflow: auto;height: 420px;padding: 5px 20px;">
              <!--由于外层有v-if控制dom树只存在当前tab页，所以不用:prop，直接用官方示例中的prop-->
              <el-form-item v-if="hospitalId == 38 && item.name != 'myocardialenzymes'" label="抽血时间 :"
                prop="drawbloodTime1">
                <el-date-picker v-model="item.request_tab_data.drawbloodTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <el-form-item v-else label="抽血时间 :" prop="drawbloodTime">
                <el-date-picker v-model="item.request_tab_data.drawbloodTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <el-form-item v-if="hospitalId == 38 && item.name != 'myocardialenzymes'" label="报告时间 :"
                prop="reportTime1">
                <el-date-picker v-model="item.request_tab_data.reportTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <el-form-item v-else label="报告时间 :" prop="reportTime">
                <el-date-picker v-model="item.request_tab_data.reportTime" type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期时间" />
              </el-form-item>
              <div v-if="item.name === 'myocardialenzymes'">
                <el-form-item v-for="(sub, index) in BiomarkersNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'FourItemsBloodCoagulation'">
                <el-form-item v-for="(sub, index) in CoagulationNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'bloodRoutineExamination'">
                <el-form-item v-for="(sub, index) in RoutineBloodNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <div v-if="item.name === 'serumCreatinine'">
                <el-form-item v-for="(sub, index) in BiochemistryNameList" :key="index" :prop="sub.type"
                  :label="sub.abbr + ' (' + sub.unit + ')' + ' :'" class="is-required">
                  <el-input v-model="sub.value" />
                </el-form-item>
              </div>
              <el-form-item label="备注 :" prop="remarks">
                <el-input v-model="item.request_tab_data.remarks" type="textarea" />
              </el-form-item>
            </el-form>
          </div>
        </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="rf('table_url', editableTabsValue)">重 置</el-button>
        <el-button style="margin-left: 40px;" type="primary" @click="tj('table_url', editableTabsValue)">保 存</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import echarts from 'echarts'
import {
  queryBloodData,
  // saveBloodnew,
  getAllOnUseTesttarget,
  queryMyocardialenzymes
} from '@/api/green-channel/bloodExamination'
import { saveBloodnew } from '@/api/green-channel/bloodExaminationStroke'
export default {
  // 由主页面(父组件) 接收来的, 选择项的数据
  props: ['checkrowdata'], // 由主页面(父组件) 接收来的, 选择项的数据
  data() {
    return {
      noData: false,
      hospitalId: '',
      editableTabsValue: 'myocardialenzymes',
      editableTabs: [
        {
          title: '生物标志物',
          name: 'myocardialenzymes',
          show: true, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '凝血功能',
          name: 'FourItemsBloodCoagulation',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '血常规',
          name: 'bloodRoutineExamination',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }, {
          title: '血生化',
          name: 'serumCreatinine',
          show: false, // 控制dom中只存在当前选择的tab页
          request_tab_data: {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }
      ],
      // 表单验证规则
      rules: {
        drawbloodTime: [
          { required: true, message: '必须填写抽血时间', trigger: 'blur' }
        ],
        reportTime: [{
          required: true,
          message: '必须填写报告时间',
          trigger: 'blur'
        }]
      },
      // 新增血液检查
      // 对应数据值
      // 检测项目列表
      allOnUse: [],
      BiomarkersNameList: [],
      BiomarkersNameListcopy: [],
      CoagulationNameList: [],
      CoagulationNameListcopy: [],
      RoutineBloodNameList: [],
      RoutineBloodNameListcopy: [],
      BiochemistryNameList: [],
      BiochemistryNameListcopy: [],
      // 是否弹窗
      newincalogase: false,
      /* end ------------------- */
      dialogVisible: false, // 趋势图
      myocardialenzymesList: [], // 生物标志物
      FourItemsBloodCoagulationList: [], // 凝血功能
      FourItemsBloodCoagulationListInput: [], // 凝血功能(机器录入)
      bloodRoutineExaminationList: [], // 血常规
      serumCreatinineList: [], // 血生化
      myocardialenzymesRange: [], // 生命标志物取值范围

      msgdataTestTime: '', // 设备录入检测时间

      /* 修改-保存 - 页面显示  */
      newParestMyocardiaData: [],
      /* 页面单位 */
      /* “肌钙蛋白T”、“肌钙蛋白I” */
      TroponinTUnit: [], // “肌钙蛋白T”
      TroponinIUnit: [], // “肌钙蛋白I”
      // value: 'ng/L',
      /* “D-二聚体”、“肌红蛋白”、“肌酸激酶同工酶” */
      polymersUnit: [], // “D-二聚体”
      myoglobinUnit: [], // “肌红蛋白”
      CKMBUnit: [], // “肌酸激酶同工酶”
      // valueTwo: 'ng/mL',
      /* 肌钙蛋白I  */
      option: [{
        valueone: '阳性',
        label: '阳性'
      }, {
        valueone: '阴性',
        label: '阴性'
      }], // 肌钙蛋白I选框
      valueone: ''
      /* end ---------------- */
    }
  },
  computed: {},
  updated() { },
  created() {
    this.hospitalId = this.$store.getters.hospitalId
    this.getBloodData()
    this.getAllOnUseTesttarget()
  },
  methods: {
    tj(formName, editableTabsValue) {
      let tips =''
      console.log(formName, editableTabsValue, this.BiochemistryNameList)
      this.$refs[formName][0].validate(valid => {
        if (valid) {
          // 业务逻辑...
          // const jsonObj = {}
          let instance = ''
          let data = {}
          
          this.editableTabs.forEach((res) => {
            if (res.name === editableTabsValue) {
              let domains = []
              if (editableTabsValue === 'myocardialenzymes') {
                instance = 'biomarker'
                console.log(this.BiomarkersNameList, 'BiomarkersNameList')
                this.BiomarkersNameList.forEach((sub) => {
                  if (sub.value) {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target === 'TroponinI' && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        sub.judgement = Number(sub.value) > Number(alone.normalRangeEnd) ? '阳性' : '阴性'
                      } else if (sub.type === alone.target === 'TroponinI' && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        sub.judgement = Number(sub.value) > Number(alone.normalRangeStart) ? '阳性' : '阴性'
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeStart)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                // domains = this.BiomarkersNameList.filter((item, i) => {
                //   return item.value !== ''
                // })
                domains = this.BiomarkersNameList
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: 'test',
                  itemName: res.title,
                  itemType: editableTabsValue,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  ntpbnp: domains[0] ? domains[0].value ? domains[0].value : '' : '', // varchar(16) DEFAULT '' comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
                  ntpbnp_u: domains[0] ? domains[0].unit ? domains[0].unit : '' : '', // varchar(16) DEFAULT ''comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
                  ntpbnp_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
                  dimer: domains[1] ? domains[1].value ? domains[1].value : '' : '', // varchar(16) DEFAULT '' comment 'D-二聚体',
                  dimer_u: domains[1] ? domains[1].unit ? domains[1].unit : '' : '', // varchar(16) DEFAULT ''comment 'D-二聚体',
                  dimer_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'D-二聚体',
                  bnp: domains[2] ? domains[2].value ? domains[2].value : '' : '', // varchar(16) DEFAULT '' comment '脑钠肽 brain natriuretic peptide',
                  bnp_u: domains[2] ? domains[2].unit ? domains[2].unit : '' : '', // varchar(16) DEFAULT ''comment '脑钠肽 brain natriuretic peptide',
                  bnp_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '脑钠肽 brain natriuretic peptide',
                  troponinT: domains[3] ? domains[3].value ? domains[3].value : '' : '', // varchar(16) DEFAULT '' comment '肌钙蛋白T',
                  troponinT_u: domains[3] ? domains[3].unit ? domains[3].unit : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白T',
                  troponinT_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白T',
                  troponinI: domains[4] ? domains[4].value ? domains[4].value : '' : '', // varchar(16) DEFAULT '' comment '肌钙蛋白I',
                  troponinI_u: domains[4] ? domains[4].unit ? domains[4].unit : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白I',
                  troponinI_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[4].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白I',
                  ckmb: domains[5] ? domains[5].value ? domains[5].value : '' : '', // varchar(16) DEFAULT '' comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
                  ckmb_u: domains[5] ? domains[5].unit ? domains[5].unit : '' : '', // varchar(16) DEFAULT ''comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
                  ckmb_i: domains[5] ? domains[5].judgement === '偏低' ? 'L' : domains[5].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
                  myoglobin: domains[6] ? domains[6].value ? domains[6].value : '' : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
                  myoglobin_u: domains[6] ? domains[6].unit ? domains[6].unit : '' : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
                  myoglobin_i: domains[6] ? domains[6].judgement === '偏低' ? 'L' : domains[6].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
                  // bs: domains[0].value,
                  // bs_u: domains[0].unit,
                  // bs_i: domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  version: 0,
                  status: 1,
                  judgement: 0,
                  hasAudio: false,
                  hasPhoto: false,
                  remarks: res.request_tab_data.remarks
                }
              } else if (editableTabsValue === 'FourItemsBloodCoagulation') {
                instance = 'coagulation'
                this.CoagulationNameList.forEach((sub) => {
                  if (sub.value != '') {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (sub.value > alone.normalRangeEnd) {
                          sub.judgement = '偏高'
                        } else if (sub.value < alone.normalRangeStart) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (sub.value > alone.normalRangeStart) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (sub.value > alone.normalRangeEnd) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                domains = this.CoagulationNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: 'test',
                  itemName: res.title,
                  itemType: editableTabsValue,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  prothrombinTime: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  prothrombinTime_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  thromboplastin: domains[1] ? domains[1].value ? domains[1].value : '' : '',
                  thromboplastin_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  thrombinTime: domains[2] ? domains[2].value ? domains[2].value : '' : '',
                  thrombinTime_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  fibrinogen: domains[3] ? domains[3].value ? domains[3].value : '' : '',
                  fibrinogen_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  inr: domains[4] ? domains[4].value ? domains[4].value : '' : '',
                  inr_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',

                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  version: 0,
                  status: 1,
                  judgement: 0,
                  hasAudio: false,
                  hasPhoto: false,
                  remarks: res.request_tab_data.remarks
                }
              } else if (editableTabsValue === 'bloodRoutineExamination') {
                instance = 'routineblood'
                this.RoutineBloodNameList.forEach((sub) => {
                  if (sub.value) {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else if (Number(sub.value) < Number(alone.normalRangeStart)) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (Number(sub.value) > Number(alone.normalRangeStart)) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (Number(sub.value) > Number(alone.normalRangeEnd)) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                domains = this.RoutineBloodNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: 'test',
                  itemName: res.title,
                  itemType: editableTabsValue,
                  polarity: 0,
                  // json: JSON.stringify(jsonObj),
                  plateletCount: domains[0] ? domains[0].value ? domains[0].value : '' : '', // '血小板计数',
                  plateletCount_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血小板计数',
                  erythrocyteCount: domains[1] ? domains[1].value ? domains[1].value : '' : '', // '红细胞计数',
                  erythrocyteCount_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[1].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
                  redcell: domains[1] ? domains[1].value ? domains[1].value : '' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
                  redcell_i: domains[1] ? domains[1].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
                  hemoglobin: domains[2] ? domains[2].value ? domains[2].value : '' : '', // '血红蛋白',
                  hemoglobin_i: domains[2] ? domains[2].judgement === '偏低' ? 'L' : domains[2].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血红蛋白',
                  leukocyte: domains[3] ? domains[3].value ? domains[3].value : '' : '', // '白细胞',
                  leukocyte_i: domains[3] ? domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '白细胞',

                  granulocyte: domains[4] ? domains[4].value ? domains[4].value : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
                  granulocyte_i: domains[4] ? domains[4].judgement === '偏低' ? 'L' : domains[4].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
                  granulocyte_1: domains[5] ? domains[5].value ? domains[5].value : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
                  granulocyte_1_i: domains[5] ? domains[5].judgement === '偏低' ? 'L' : domains[5].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
                  lobulated: domains[6] ? domains[6].value ? domains[6].value : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
                  lobulated_i: domains[6] ? domains[6].judgement === '偏低' ? 'L' : domains[6].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
                  lobulated_1: domains[7] ? domains[7].value ? domains[7].value : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
                  lobulated_1_i: domains[7] ? domains[7].judgement === '偏低' ? 'L' : domains[7].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
                  eosinophils: domains[8] ? domains[8].value ? domains[8].value : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
                  eosinophils_i: domains[8] ? domains[8].judgement === '偏低' ? 'L' : domains[8].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
                  eosinophils_1: domains[9] ? domains[9].value ? domains[9].value : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
                  eosinophils_1_i: domains[9] ? domains[9].judgement === '偏低' ? 'L' : domains[9].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
                  basophil: domains[10] ? domains[10].value ? domains[10].value : '' : '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',
                  basophil_i: domains[10] ? domains[10].judgement === '偏低' ? 'L' : domains[10].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',
                  basophil_1: domains[11] ? domains[11].value ? domains[11].value : '' : '', // varchar(16)  DEFAULT '' comment '嗜碱粒细胞(x10/L)',
                  basophil_1_i: domains[11] ? domains[11].judgement === '偏低' ? 'L' : domains[11].judgement === '偏高' ? 'H' : '' : '', // varchar(16)  DEFAULT '' comment '嗜碱粒细胞(x10/L)',
                  lymphocyte: domains[12] ? domains[12].value ? domains[12].value : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞',
                  lymphocyte_i: domains[12] ? domains[12].judgement === '偏低' ? 'L' : domains[12].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞',
                  lymphocyte_1: domains[13] ? domains[13].value ? domains[13].value : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞(x10/L)',
                  lymphocyte_1_i: domains[13] ? domains[13].judgement === '偏低' ? 'L' : domains[13].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞(x10/L)',
                  monocyte: domains[14] ? domains[14].value ? domains[14].value : '' : '', // varchar(16) DEFAULT '' comment '单核细胞',
                  monocyte_i: domains[14] ? domains[14].judgement === '偏低' ? 'L' : domains[14].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '单核细胞',
                  monocyte_1: domains[15] ? domains[15].value ? domains[15].value : '' : '', // varchar(16) DEFAULT '' comment '单核细胞(x10/L)',
                  monocyte_1_i: domains[15] ? domains[15].judgement === '偏低' ? 'L' : domains[15].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '单核细胞(x10/L)',
                  // leukocyte_c: '', // '白细胞计数',
                  // leukocyte_cc: domains[3].value, // '白细胞分类计数',
                  // leukocyte_c_i: '', // varchar(16) DEFAULT '' comment '白细胞计数',
                  // leukocyte_cc_i: domains[3].judgement === '偏低' ? 'L' : domains[3].judgement === '偏高' ? 'H' : '', // varchar(16) DEFAULT '' comment '白细胞分类计数',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  version: 0,
                  status: 1,
                  judgement: 0,
                  hasAudio: false,
                  hasPhoto: false,
                  remarks: res.request_tab_data.remarks
                }
              } else if (editableTabsValue === 'serumCreatinine') {

                instance = 'biochemistry'
                
                this.BiochemistryNameList.forEach((sub) => {
                  if (sub.type === "creatinine" && sub.value == '' && !sub.value) {
                    tips = '血清肌酐'
                    return
                  }
                  if (sub.value) {
                    this.allOnUse.forEach(alone => {
                      if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                        if (sub.value > alone.normalRangeEnd) {
                          sub.judgement = '偏高'
                        } else if (sub.value < alone.normalRangeStart) {
                          sub.judgement = '偏低'
                        } else {
                          sub.judgement = '正常'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                        if (sub.value > alone.normalRangeStart) {
                          sub.judgement = '正常'
                        } else {
                          sub.judgement = '偏低'
                        }
                      } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                        if (sub.value > alone.normalRangeEnd) {
                          sub.judgement = '偏高'
                        } else {
                          sub.judgement = '正常'
                        }
                      }
                    })
                  }
                })
                domains = this.BiochemistryNameList
                // .filter((item, i) => {
                //   return item.value !== ''
                // })
                data = {
                  id: null,
                  userId: this.$store.getters.userId,
                  doctor: this.$store.getters.name,
                  department: this.$store.getters.deptment,
                  missionId: this.checkrowdata.dispatchId,
                  medicalId: this.checkrowdata.medicalId,
                  instanceType: 'test',
                  itemName: res.title,
                  itemType: editableTabsValue,
                  polarity: 0,
                  creatinine: domains[0] ? domains[0].value ? domains[0].value : '' : '',
                  creatinine_i: domains[0] ? domains[0].judgement === '偏低' ? 'L' : domains[0].judgement === '偏高' ? 'H' : '' : '',
                  excuteTime: res.request_tab_data.drawbloodTime,
                  reportTime: res.request_tab_data.reportTime,
                  version: 0,
                  status: 1,
                  judgement: 0,
                  hasAudio: false,
                  hasPhoto: false,
                  remarks: res.request_tab_data.remarks
                }
              }
              if(tips){
                this.$message.warning(tips+"必须填写!")
                return 
              }
              if (domains.length !== 0) {
                saveBloodnew(instance, data).then(res => {
                  if (res.code === 0) {
                    this.$message({
                      message: '保存成功',
                      type: 'success'
                    })
                    this.newincalogase = false
                    this.editableTabs.forEach((item, index) => {
                      if (item.name === editableTabsValue) {
                        this.editableTabs[index].request_tab_data = {
                          drawbloodTime: '',
                          reportTime: '',
                          remarks: ''
                        }
                      }
                    });
                    this.BiomarkersNameList = JSON.parse(JSON.stringify(this.BiomarkersNameListcopy))
                    this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
                    this.RoutineBloodNameList = JSON.parse(JSON.stringify(this.RoutineBloodNameListcopy))
                    this.BiochemistryNameList = JSON.parse(JSON.stringify(this.BiochemistryNameListcopy))
                    this.$refs[formName][0].resetFields()
                    this.getBloodData()
                  } else {
                    this.$message({
                      message: '保存失败',
                      type: 'error'
                    })
                  }
                }).catch(err => {
                  console.log(err)
                })
              } else {
                this.$message({
                  type: 'error',
                  message: '至少填写一项检测结果'
                })
              }
            }
          })
        }
      })
    },
    clickTab(tab) {
      this.editableTabs.forEach((res) => {
        if (res.name === tab.name) {
          res.show = true
        } else {
          res.show = false
        }
      })
    },
    rf(formName, editableTabsValue) {
      this.editableTabs.forEach((item, index) => {
        if (item.name === editableTabsValue) {
          this.editableTabs[index].request_tab_data = {
            drawbloodTime: '',
            reportTime: '',
            remarks: ''
          }
        }
      });
      if (editableTabsValue === 'myocardialenzymes') {
        this.BiomarkersNameList = JSON.parse(JSON.stringify(this.BiomarkersNameListcopy))
      } else if (editableTabsValue === 'FourItemsBloodCoagulation') {
        this.CoagulationNameList = JSON.parse(JSON.stringify(this.CoagulationNameListcopy))
      } else if (editableTabsValue === 'bloodRoutineExamination') {
        this.RoutineBloodNameList = JSON.parse(JSON.stringify(this.RoutineBloodNameListcopy))
      } else if (editableTabsValue === 'serumCreatinine') {
        this.BiochemistryNameList = JSON.parse(JSON.stringify(this.BiochemistryNameListcopy))
      }
      this.$refs[formName][0].resetFields()
    },
    // 新增血液检查
    // 查询所有使用中指标
    getAllOnUseTesttarget() {
      getAllOnUseTesttarget({
        greenType: '胸痛',
        hospitalId: this.$store.getters.hospitalId
      }).then((res) => {
        this.allOnUse = res.data
        this.allOnUse.forEach((item, index) => {
          // if (item.checkName === 'N-端脑利钠肽前体') {
          //   item.checkName = 'NT-proBNP'
          // } else if (item.checkName === '国际标准化比值') {
          //   item.checkName = 'INR'
          // } else
          if (item.checkName === '肌钙蛋白T') {
            item.unit.split(',').forEach(sub => {
              this.TroponinTUnit.push({
                value: sub,
                label: sub
              })
            })
          } else if (item.checkName === '肌钙蛋白I') {
            item.unit.split(',').forEach(sub => {
              this.TroponinIUnit.push({
                value: sub,
                label: sub
              })
            })
          } else if (item.checkName === 'D-二聚体') {
            item.unit.split(',').forEach(sub => {
              this.polymersUnit.push({
                valueTwo: sub,
                label: sub
              })
            })
          } else if (item.checkName === '肌红蛋白') {
            item.unit.split(',').forEach(sub => {
              this.myoglobinUnit.push({
                valueTwo: sub,
                label: sub
              })
            })
          } else if (item.checkName === '肌酸激酶同工酶') {
            item.unit.split(',').forEach(sub => {
              this.CKMBUnit.push({
                valueTwo: sub,
                label: sub
              })
            })
          }
        })
        this.allOnUse.forEach((item, index) => {
          if (item.projectName === '生物标志物') {
            this.BiomarkersNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.BiomarkersNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '凝血功能') {
            this.CoagulationNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.CoagulationNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '血常规') {
            this.RoutineBloodNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.RoutineBloodNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          } else if (item.projectName === '血生化') {
            if (item.checkName === '肌酐') {
              item.checkName = '血清' + item.checkName
            }
            this.BiochemistryNameList.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
            this.BiochemistryNameListcopy.push({
              abbr: item.checkName,
              unit: item.content,
              type: item.target,
              value: '',
              judgement: ''
            })
          }
        })
      })
    },
    /* 点击button */
    popup() {
      this.newincalogase = true
    },
    // 新增关闭窗口
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => { })
    },
    /* end------------------------- */
    // 联动阴阳性
    linkagejudgement(val) {
      for (const optionIndex in this.option) {
        this.allOnUse.forEach(res => {
          if (res.target === 'TroponinI' && res.normalRangeEnd !== '' && res.normalRangeStart === '') {
            if (val > res.normalRangeEnd) {
              this.valueone = this.option[optionIndex].valueone
            } else {
              this.valueone = this.option[optionIndex].valueone
            }
          } else if (res.target === 'TroponinI' && res.normalRangeEnd === '' && res.normalRangeStart !== '') {
            if (val > res.normalRangeStart) {
              this.valueone = this.option[optionIndex].valueone
            } else {
              this.valueone = this.option[optionIndex].valueone
            }
          }
        })
      }
    },
    // 血液检查接口
    getBloodData() {
      const instance = 'test'
      const dispatch = this.checkrowdata.dispatchId
      queryBloodData(instance, dispatch).then(res => {
        if (res.data && res.data.chipsOrder.length === 0 && res.data.lCare.length === 0) {
          this.noData = true
          return
        } else {
          this.noData = false
        }
        this.newParestMyocardiaData = []
        this.myocardialenzymesList = []
        this.FourItemsBloodCoagulationList = []
        this.bloodRoutineExaminationList = []
        this.serumCreatinineList = []
        const arr = JSON.parse(JSON.stringify(res.data.chipsOrder))
        for (const item in arr) {
          if (arr[item].itemType === 'myocardialenzymes') {
            arr[item].json = JSON.parse(arr[item].json)
            this.myocardialenzymesList.push(arr[item])
            const markersMedicine = {
              '肌钙蛋白T': [],
              '肌钙蛋白I': [],
              '肌酸激酶同工酶': [],
              '肌红蛋白': [],
              'N-端脑利钠肽前体': [],
              'D-二聚体': [],
              '脑钠肽': []
            }
            const markersunit = {
              '肌钙蛋白T': {
                unit: 'ng/L',
                type: 'TroponinT'
              },
              '肌钙蛋白I': {
                unit: 'ng/L',
                type: 'TroponinI'
              },
              '肌酸激酶同工酶': {
                unit: 'ng/mL',
                type: 'CKMB'
              },
              '肌红蛋白': {
                unit: 'ng/mL',
                type: 'myoglobin'
              },
              'N-端脑利钠肽前体': {
                unit: 'pg/mL',
                type: 'nt-probnp'
              },
              'D-二聚体': {
                unit: 'ng/mL',
                type: 'polymers'
              },
              '脑钠肽': {
                unit: 'pg/mL',
                type: 'peptide'
              }
            }
            const parestMyocardiaData = JSON.parse(JSON.stringify(this.myocardialenzymesList))
            parestMyocardiaData.forEach((el, index) => {
              // 根据全集补全缺失数据，避免折线图数据缺失
              Object.keys(markersMedicine).forEach(item => {
                // 判断已有数据是否存在全量7项
                const exist = el.json.orderDetail.some((res) => {
                  return res.abbr === item
                })
                // 如缺失，则补齐abbr，value项
                if (!exist) {
                  for (const i in markersunit) {
                    if (item === i) {
                      el.json.orderDetail.push({
                        abbr: item,
                        value: '',
                        judgement: '',
                        type: markersunit[i].type,
                        unit: markersunit[i].unit
                      })
                    }
                  }
                }
              })
            })
            console.log(parestMyocardiaData, 'parestMyocardiaData')
            this.newParestMyocardiaData = JSON.parse(JSON.stringify(parestMyocardiaData))
          } else if (arr[item].itemType === 'FourItemsBloodCoagulation') {
            arr[item].json = JSON.parse(arr[item].json)
            this.FourItemsBloodCoagulationList.push(arr[item])
          } else if (arr[item].itemType === 'bloodRoutineExamination') {
            arr[item].json = JSON.parse(arr[item].json)
            this.bloodRoutineExaminationList.push(arr[item])
            console.log("this.bloodRoutineExaminationList", this.bloodRoutineExaminationList)
          } else if (arr[item].itemType === 'serumCreatinine') {
            arr[item].json = JSON.parse(arr[item].json)
            if (arr[item].json.orderDetail && arr[item].json.orderDetail.length > 0) {
              arr[item].json.orderDetail.forEach((el, index, arr) => {
                if (el.abbr === '肌酐') {
                  arr[index].abbr = '血清' + el.abbr
                }
              })
            }
            this.serumCreatinineList.push(arr[item])
          }
        }
        for (const lCareItem in res.data.lCare) {
          if (res.data.lCare[lCareItem].itemName === '凝血功能') {
            this.FourItemsBloodCoagulationListInput.push(res.data.lCare[lCareItem])
            const testTime = res.data.lCare[lCareItem].msgdata.testTime
            const data = new Date(testTime)
            const y = data.getFullYear()
            const m = data.getMonth()
            const d = data.getDate()
            const hh = data.getHours()
            const mm = data.getMinutes()
            const ss = data.getSeconds()
            this.msgdataTestTime = y + '-' + m + '-' + d + ' ' + hh + ':' + mm + ':' + ss
          }
        }
      }).catch(err => {
        console.log(err)
      })
    },
    // 生命标志物趋势图
    goViewMyocardialenzymes() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '肌钙蛋白T': [],
        '肌钙蛋白I': [],
        '肌酸激酶同工酶': [],
        '肌红蛋白': [],
        'N-端脑利钠肽前体': [],
        'D-二聚体': [],
        '脑钠肽': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.myocardialenzymesList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.created_at)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: '0'
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['肌钙蛋白T', '肌钙蛋白I', '肌酸激酶同工酶', '肌红蛋白', 'N-端脑利钠肽前体', 'D-二聚体', '脑钠肽']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineMyocardialenzymes(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineMyocardialenzymes(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '生命标志物'
        // },
        tooltip: {
          trigger: 'item',
          formatter: '{b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },
    // 凝血功能趋势图
    goViewFourItemsBloodCoagulation() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '凝血酶原时间': [],
        '活化部分凝血活酶': [],
        '凝血酶时间': [],
        '纤维蛋白原': [],
        '国际标准化比值': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.FourItemsBloodCoagulationList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.created_at)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: '0'
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['凝血酶原时间', '活化部分凝血活酶', '凝血酶时间', '纤维蛋白原', '国际标准化比值']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineFourItemsBloodCoagulation(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineFourItemsBloodCoagulation(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '凝血功能'
        // },
        tooltip: {
          trigger: 'item',
          formatter: '{b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },
    // 血常规趋势图
    goViewbloodRoutineExamination() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '血小板计数': [],
        '红细胞计数': [],
        '血红蛋白': [],
        '白细胞': [],
        '中性杆状核粒细胞': [],
        '中性杆状核粒细胞(x10/L)': [],
        '中性分叶核粒细胞': [],
        '中性分叶核粒细胞(x10/L)': [],
        '嗜酸粒细胞': [],
        '嗜酸粒细胞(x10/L)': [],
        '嗜碱粒细胞': [],
        '嗜碱粒细胞(x10/L)': [],
        '淋巴细胞': [],
        '淋巴细胞(x10/L)': [],
        '单核细胞': [],
        '单核细胞(x10/L)': [],
        '白细胞计数': [],
        '白细胞分类计数': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.bloodRoutineExaminationList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.created_at)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: 0
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      abbrArr = ['血小板计数', '红细胞计数', '血红蛋白', '白细胞', '中性杆状核粒细胞', '中性杆状核粒细胞(x10/L)', '中性分叶核粒细胞', '中性分叶核粒细胞(x10/L)',
        '嗜酸粒细胞', '嗜酸粒细胞(x10/L)', '嗜碱粒细胞', '嗜碱粒细胞(x10/L)', '淋巴细胞', '淋巴细胞(x10/L)', '单核细胞', '单核细胞(x10/L)', '白细胞计数', '白细胞分类计数'
      ]
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLinebloodRoutineExamination(createdMyTime, myValue, abbrArr)
      })
    },
    drawLinebloodRoutineExamination(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '血常规'
        // },
        tooltip: {
          trigger: 'item',
          formatter: '{b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 血生化趋势图
    goViewSerumCreatinine() {
      const createdMyTime = []
      const myValue = []
      let abbrArr = []
      // 定义已知数据全量集
      const optionAll = {
        '血清肌酐': []
      }
      // 深拷贝数据避免影响页面数据
      const parestData = JSON.parse(JSON.stringify(this.serumCreatinineList))
      parestData.forEach((el, index) => {
        // 做x时间轴数据
        createdMyTime.push(el.created_at)
        // 补全缺失信息
        // 根据全集补全缺失数据，避免折线图数据缺失
        Object.keys(optionAll).forEach(item => {
          // 判断已有数据是否存在全量5项
          const exist = el.json.orderDetail.some((res) => {
            if (!res.value) {
              res.value = 0
            }
            return res.abbr === item
          })
          // 如缺失，则补齐abbr，value项 供生成折线图使用
          if (!exist) {
            el.json.orderDetail.push({
              abbr: item,
              value: '0'
            })
          }
        })
        // 循环已有数据，值放入optionAll内，以供生成折线图
        el.json.orderDetail.forEach((item, key) => {
          if (optionAll[item.abbr]) optionAll[item.abbr].push(item.value)
        })
      })
      Object.keys(optionAll).forEach(item => {
        myValue.push({
          name: item,
          data: optionAll[item],
          type: 'line'
        })
      })
      console.log(myValue, 'myValue')
      abbrArr = ['血清肌酐']
      createdMyTime.reverse()
      this.dialogVisible = true
      this.$nextTick(function () {
        this.drawLineSerumCreatinine(createdMyTime, myValue, abbrArr)
      })
    },
    drawLineSerumCreatinine(createdMyTime, myValue, abbrArr) {
      const chart = this.$refs.chart
      const trendList = {
        // title: {
        //   text: '血生化'
        // },
        tooltip: {
          trigger: 'item',
          formatter: '{b} <br /> {a} :{c}'
        },
        legend: {
          top: 0,
          left: 'center',
          data: abbrArr
        },
        xAxis: {
          type: 'category',
          data: createdMyTime
        },
        yAxis: {
          type: 'value'
        },
        dataZoom: [{
          type: 'inside'
        }],
        series: myValue
      }
      if (chart) {
        const myChart = echarts.init(chart)
        myChart.setOption(trendList)
      }
    },

    // 保存
    saveMyocardialenzymes(type, index, remark_vlaue) {
      const newindex = index
      let data = {}
      let instance = ''
      if (type === 'myocardialenzymes') {
        instance = 'biomarker'
        this.newParestMyocardiaData.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target === 'TroponinI' && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    sub.judgement = Number(sub.value) > alone.normalRangeEnd ? '阳性' : '阴性'
                  } else if (sub.type === alone.target === 'TroponinI' && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    sub.judgement = Number(sub.value) > alone.normalRangeStart ? '阳性' : '阴性'
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else if (Number(sub.value) < alone.normalRangeStart) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (Number(sub.value) > alone.normalRangeStart) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (Number(sub.value) > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              itemName: res.itemName,
              itemType: type,
              polarity: res.polarity,
              ntpbnp: res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' })[0].value : '', // varchar(16) DEFAULT '' comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
              ntpbnp_u: res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' })[0].unit : '', // varchar(16) DEFAULT ''comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
              ntpbnp_i: res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == 'N-端脑利钠肽前体' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'N-端脑利钠肽前体 N-terminal pro brain natriuretic peptide',
              dimer: res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' })[0].value : '', // varchar(16) DEFAULT '' comment 'D-二聚体',
              dimer_u: res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' })[0].unit : '', // varchar(16) DEFAULT ''comment 'D-二聚体',
              dimer_i: res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == 'D-二聚体' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'D-二聚体',
              bnp: res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' })[0].value : '', // varchar(16) DEFAULT '' comment '脑钠肽 brain natriuretic peptide',
              bnp_u: res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' })[0].unit : '', // varchar(16) DEFAULT ''comment '脑钠肽 brain natriuretic peptide',
              bnp_i: res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '脑钠肽' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '脑钠肽 brain natriuretic peptide',
              troponinT: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' })[0].value : '', // varchar(16) DEFAULT '' comment '肌钙蛋白T',
              troponinT_u: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' })[0].unit : '', // varchar(16) DEFAULT ''comment '肌钙蛋白T',
              troponinT_i: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白T' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白T',
              troponinI: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' })[0].value : '', // varchar(16) DEFAULT '' comment '肌钙蛋白I',
              troponinI_u: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' })[0].unit : '', // varchar(16) DEFAULT ''comment '肌钙蛋白I',
              troponinI_i: res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌钙蛋白I' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment '肌钙蛋白I',
              ckmb: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].value : '', // varchar(16) DEFAULT '' comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
              ckmb_u: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].unit : '', // varchar(16) DEFAULT ''comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
              ckmb_i: res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌酸激酶同工酶' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT ''comment 'creatine kinase isoenzyme 肌酸激酶同工酶',
              myoglobin: res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' })[0].value : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
              myoglobin_u: res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' })[0].unit : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
              myoglobin_i: res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '肌红蛋白' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '肌红蛋白',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
            console.log(data, 'data')
          }
        })
      } else if (type === 'FourItemsBloodCoagulation') {
        instance = 'coagulation'
        this.FourItemsBloodCoagulationList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else if (sub.value < alone.normalRangeStart) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeStart) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              polarity: res.polarity,
              inr: res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].value : '',
              inr_i: res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '国际标准化比值' })[0].judgement === '偏高' ? 'H' : '' : '',
              fibrinogen: res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].value : '',
              fibrinogen_i: res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '纤维蛋白原' })[0].judgement === '偏高' ? 'H' : '' : '',
              thrombinTime: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0].value : '',
              thrombinTime_i: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '凝血酶时间' })[0] === '偏高' ? 'H' : '' : '',
              thromboplastin: res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].value : '',
              thromboplastin_i: res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '活化部分凝血活酶' })[0].judgement === '偏高' ? 'H' : '' : '',
              prothrombinTime: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].value : '',
              prothrombinTime_i: res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '凝血酶原时间' })[0].judgement === '偏高' ? 'H' : '' : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      } else if (type === 'bloodRoutineExamination') {
        instance = 'routineblood'
        this.bloodRoutineExaminationList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else if (sub.value < alone.normalRangeStart) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeStart) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            console.log("res.json", res.json, remark_vlaue)
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              itemType: type,
              polarity: res.polarity,
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              plateletCount: res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].value : '', // '血小板计数',
              plateletCount_i: res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血小板计数' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血小板计数',
              erythrocyteCount: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].value : '', // '红细胞计数',
              erythrocyteCount_i: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
              redcell: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].value : '', // varchar(16) DEFAULT '' comment '红细胞计数',
              redcell_i: res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '红细胞计数' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '红细胞计数',
              hemoglobin: res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].value : '', // '血红蛋白',
              hemoglobin_i: res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血红蛋白' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '血红蛋白',
              leukocyte: res.json.orderDetail.filter(item => { return item.abbr == '白细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].value : '', // '白细胞',
              leukocyte_i: res.json.orderDetail.filter(item => { return item.abbr == '白细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '白细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '白细胞',
              granulocyte: res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
              granulocyte_i: res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞',
              granulocyte_1: res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞(x10/L)' })[0].value : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
              granulocyte_1_i: res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '中性杆状核粒细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性杆状核粒细胞(x10/L)',
              lobulated: res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
              lobulated_i: res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞',
              lobulated_1: res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞(x10/L)' })[0].value : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
              lobulated_1_i: res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '中性分叶核粒细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '中性分叶核粒细胞(x10/L)',
              eosinophils: res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
              eosinophils_i: res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞',
              eosinophils_1: res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞(x10/L)' })[0].value : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
              eosinophils_1_i: res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '嗜酸粒细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜酸粒细胞(x10/L)',
              basophil: res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',
              basophil_i: res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '嗜碱粒细胞',
              basophil_1: res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞(x10/L)' })[0].value : '', // varchar(16)  DEFAULT '' comment '嗜碱粒细胞(x10/L)',
              basophil_1_i: res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '嗜碱粒细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16)  DEFAULT '' comment '嗜碱粒细胞(x10/L)',
              lymphocyte: res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '淋巴细胞',
              lymphocyte_i: res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞',
              lymphocyte_1: res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞(x10/L)' })[0].value : '', // varchar(16) DEFAULT '' comment '淋巴细胞(x10/L)',
              lymphocyte_1_i: res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '淋巴细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '淋巴细胞(x10/L)',
              monocyte: res.json.orderDetail.filter(item => { return item.abbr == '单核细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '单核细胞' })[0].value : '', // varchar(16) DEFAULT '' comment '单核细胞',
              monocyte_i: res.json.orderDetail.filter(item => { return item.abbr == '单核细胞' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '单核细胞' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '单核细胞' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '单核细胞',
              monocyte_1: res.json.orderDetail.filter(item => { return item.abbr == '单核细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '单核细胞(x10/L)' })[0].value : '', // varchar(16) DEFAULT '' comment '单核细胞(x10/L)',
              monocyte_1_i: res.json.orderDetail.filter(item => { return item.abbr == '单核细胞(x10/L)' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '单核细胞(x10/L)' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '单核细胞(x10/L)' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '单核细胞(x10/L)',
              leukocyte_c: res.json.orderDetail.filter(item => { return item.abbr == '白细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞计数' })[0].value : '', // varchar(16) DEFAULT '' comment '白细胞计数',
              leukocyte_c_i: res.json.orderDetail.filter(item => { return item.abbr == '白细胞计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '白细胞计数' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '白细胞计数',
              leukocyte_cc: res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].value : '', // varchar(16) DEFAULT '' comment '白细胞分类计数',
              leukocyte_cc_i: res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].judgement === '偏低' ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '白细胞分类计数' })[0].judgement === '偏高' ? 'H' : '' : '', // varchar(16) DEFAULT '' comment '白细胞分类计数',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
            console.log(data, 'data')
          }
        })
      } else if (type === 'serumCreatinine') {
        instance = 'biochemistry'
        this.serumCreatinineList.forEach((res, index) => {
          if (index === newindex) {
            res.json.orderDetail.forEach(sub => {
              if (sub.value !== '') {
                this.allOnUse.forEach(alone => {
                  if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else if (sub.value < alone.normalRangeStart) {
                      sub.judgement = '偏低'
                    } else {
                      sub.judgement = '正常'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd === '' && alone.normalRangeStart !== '') {
                    if (sub.value > alone.normalRangeStart) {
                      sub.judgement = '正常'
                    } else {
                      sub.judgement = '偏低'
                    }
                  } else if (sub.type === alone.target && alone.normalRangeEnd !== '' && alone.normalRangeStart === '') {
                    if (sub.value > alone.normalRangeEnd) {
                      sub.judgement = '偏高'
                    } else {
                      sub.judgement = '正常'
                    }
                  }
                })
              }
            })
            console.log(res.json.orderDetail)
            data = {
              id: res.id,
              userId: res.userId,
              missionId: res.missionId,
              medicalId: res.medicalId,
              instanceType: res.instanceType,
              itemName: res.itemName,
              bloodTime: res.json.bloodTime ? res.json.bloodTime : '',
              resultTime: res.json.resultTime ? res.json.resultTime : '',
              excuteTime: res.json.bloodTime ? res.json.bloodTime : '',
              reportTime: res.json.resultTime ? res.json.resultTime : '',
              itemType: type,
              polarity: res.polarity,
              creatinine: res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' }).length > 0 ? res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' })[0].value : '',
              creatinine_i: res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' }).length > 0 ? 'L' : res.json.orderDetail.filter(item => { return item.abbr == '血清肌酐' })[0].judgement === '偏高' ? 'H' : '',
              version: res.version,
              status: res.status,
              judgement: res.judgement,
              hasAudio: res.hasAudio,
              hasPhoto: res.hasPhoto,
              remarks: remark_vlaue
            }
          }
        })
      }
      saveBloodnew(instance, data).then(res => {
        this.$message({
          message: '保存成功',
          type: 'success'
        })
        this.getBloodData()
      }).catch(err => {
        console.log(err)
      })
    }
  }
}
</script>

<style scoped>
#box {
  width: 100%;
  height: 100%;
}

.content {
  width: 100%;
  background-color: white;
  margin: 0px 0px 20px 0px;
  padding: 10px 20px;
  position: relative;
  border-bottom: 1px solid #DFDEE3;
}

.trendContent {
  position: absolute;
  top: 0px;
  right: 20px;
}

.addContent {
  width: 100%;
  height: 50px;
  border-bottom: 1px solid #DFDEE3;
}

.publicStyle {
  background-color: #F9F9F9;
  padding: 20px 20px;
  margin: 5px 0;
}

.publicDown {
  clear: both;
  margin: 0px 0 10px 0;
  padding-left: 32px;
  font-size: 14px;
}

.el-row {
  margin-bottom: 5px;
}

.el-col {
  margin-bottom: 5px;
}

.bg-purple-light {
  text-align: right;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

.red-star::before {
  content: "*";
  color: red;
}
</style>
